home *** CD-ROM | disk | FTP | other *** search
/ PC Pro 1997 December / PC Pro December 1997 CD-Rom coverdisc.iso / symantec / dbAnywh / JAVA.BIN / CLASSES.ZIP / sun / tools / tree / SuperExpression.class (.txt) < prev    next >
Encoding:
Java Class File  |  1996-12-14  |  2.2 KB  |  52 lines

  1. package sun.tools.tree;
  2.  
  3. import java.util.Hashtable;
  4. import sun.tools.asm.Assembler;
  5. import sun.tools.java.ClassDeclaration;
  6. import sun.tools.java.Constants;
  7. import sun.tools.java.Environment;
  8. import sun.tools.java.Type;
  9.  
  10. public class SuperExpression extends Expression {
  11.    LocalField field;
  12.  
  13.    public SuperExpression(int var1) {
  14.       super(83, var1, Type.tObject);
  15.    }
  16.  
  17.    public long checkValue(Environment var1, Context var2, long var3, Hashtable var5) {
  18.       ClassDeclaration var6 = var2.field.getClassDefinition().getSuperClass();
  19.       if (!var2.field.isStatic() && !var2.field.isVariable() && var6 != null) {
  20.          if ((var3 & 1L) == 0L) {
  21.             var1.error(super.where, "access.inst.before.super", Constants.idSuper);
  22.             super.type = Type.tError;
  23.             return var3;
  24.          } else {
  25.             super.type = var6.getType();
  26.             this.field = var2.getLocalField(Constants.idThis);
  27.             ++this.field.readcount;
  28.             return var3;
  29.          }
  30.       } else {
  31.          var1.error(super.where, "undef.var", Constants.idSuper);
  32.          super.type = Type.tError;
  33.          return var3;
  34.       }
  35.    }
  36.  
  37.    public Expression inlinevalue(Environment var1, Context var2) {
  38.       if (this.field == null) {
  39.          return this;
  40.       } else if (this.field != null) {
  41.          Expression var3 = (Expression)this.field.getValue(var1);
  42.          return (Expression)(var3 != null ? var3 : this);
  43.       } else {
  44.          return this;
  45.       }
  46.    }
  47.  
  48.    public void codeValue(Environment var1, Context var2, Assembler var3) {
  49.       var3.add(super.where, 25, new Integer(this.field.number));
  50.    }
  51. }
  52.